<?php

class Goear {

    private $id;
    private $goearapi = "http://www.goear.com/tracker758.php?f=";

    public function __construct($url) {
        $urlparse = explode('/', parse_url($url, PHP_URL_PATH));
        $this->id = $urlparse[2];
    }

    public function urlMp3() {
        $xml = new SimpleXMLElement($this->goearapi . $this->id, NULL, TRUE);

        return $xml->song->attributes()->path;
    }

    public function getArtist() {
        $xml = new SimpleXMLElement($this->goearapi . $this->id, NULL, TRUE);

        return $xml->song->attributes()->artist;
    }

    public function getTitle() {
        $xml = new SimpleXMLElement($this->goearapi . $this->id, NULL, TRUE);

        return $xml->song->attributes()->title;
    }
    
    public function getCover() {
        $xml = new SimpleXMLElement($this->goearapi . $this->id, NULL, TRUE);

        return $xml->song->attributes()->bild;
    }

}

?>